<template>
  <div class="zwj">
    <homeheader/>
    <home-drop/>
    <home-recommend :list="recommendList"></home-recommend>
    <homedown/>
  </div>
</template>

<script>
// "./"代表本目录，"../代表上一次目录
import Homeheader from "./zwj/EntertainHeader.vue";
import HomeRecommend from "./zct/components/EntermainRecommend.vue";
import Homedown from "./zwj/EntertainDown.vue";
import HomeDrop from "./xf/EntertainDrop";
import axios from "axios";

export default {
  name: "home",
  components: {
    Homeheader,
    Homedown,
    HomeRecommend,
    HomeDrop,
  },
  data: function() {
    return {
      iconList: [],
      recommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios.get("/mock/entertain.json").then(this.getHomeResponseInfo);
    },
    getHomeResponseInfo(response) {
      //  console.log(response.data);
      let res = response.data; //就是home.json里面的内容
      if (res.success && res.dataList) {
        const data = res.dataList; //取json中的datalist属性
        // console.log(data.iconLists.length)
        this.iconList = data.iconLists;
        this.recommendList = data.recommendLists;
      }
    }
  }
};
</script>
